package com.gy.def.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

@SuppressWarnings("unused")
public class VerifyData {

    /**
     * 判断是否手机号
     * @param phone 电话号码
     * @return 是否为手机
     */
    public static boolean isMobilePhone(String phone) {
        boolean flag;
        String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$";
        if (phone.length() != 11) {
            flag= false;
        } else {
            Pattern p = Pattern.compile(regex);
            Matcher m = p.matcher(phone);
            flag = m.matches();
        }
        return flag;
    }

}
